import { S } from '../../s';
import { IPSAppDEField } from '../../app/dataentity/ipsapp-defield';
import { IPSNavigateContext } from '../ipsnavigate-context';
import { IPSNavigateParam } from '../ipsnavigate-param';
import { IPSDETree } from './ipsdetree';
import { IPSDETreeNode } from './ipsdetree-node';
import { IPSDETreeNodeRS } from './ipsdetree-node-rs';
import { IPSDETreeNodeRSParam } from './ipsdetree-node-rsparam';
import { IPSDER1N } from '../../dataentity/der/ipsder1-n';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDETreeNodeRSImpl
  extends PSModelObjectImpl
  implements IPSDETreeNodeRS
{
  protected childpsdetreenode: IPSDETreeNode;
  getChildPSDETreeNode(): IPSDETreeNode | null {
    if (this.childpsdetreenode != null) return this.childpsdetreenode;
    const value = this.M.getChildPSDETreeNode;
    if (value == null) {
      return;
    }
    const ipsdetree = this.getParentPSModelObject(S._264) as IPSDETree;
    if (ipsdetree != null) {
      this.childpsdetreenode = ipsdetree.findPSDETreeNode(value);
    }
    return this.childpsdetreenode;
  }

  protected psdetreenodersparams: IPSDETreeNodeRSParam[];
  getPSDETreeNodeRSParams(): IPSDETreeNodeRSParam[] | null {
    return (
      this.psdetreenodersparams ||
      (this.psdetreenodersparams = this.fillChildListModel(
        this.M.getPSDETreeNodeRSParams,
        S._1b6,
      ) as IPSDETreeNodeRSParam[])
    );
  }

  findPSDETreeNodeRSParam(objKey: any): IPSDETreeNodeRSParam | null {
    return this.getPSModel5(
      S._1b6,
      this.getPSDETreeNodeRSParams(),
      objKey,
    ) as IPSDETreeNodeRSParam;
  }

  protected psnavigatecontexts: IPSNavigateContext[];
  getPSNavigateContexts(): IPSNavigateContext[] | null {
    return (
      this.psnavigatecontexts ||
      (this.psnavigatecontexts = this.fillChildListModel(
        this.M.getPSNavigateContexts,
        S._8c,
      ) as IPSNavigateContext[])
    );
  }

  findPSNavigateContext(objKey: any): IPSNavigateContext | null {
    return this.getPSModel5(
      S._8c,
      this.getPSNavigateContexts(),
      objKey,
    ) as IPSNavigateContext;
  }

  protected psnavigateparams: IPSNavigateParam[];
  getPSNavigateParams(): IPSNavigateParam[] | null {
    return (
      this.psnavigateparams ||
      (this.psnavigateparams = this.fillChildListModel(
        this.M.getPSNavigateParams,
        S._8a,
      ) as IPSNavigateParam[])
    );
  }

  findPSNavigateParam(objKey: any): IPSNavigateParam | null {
    return this.getPSModel5(
      S._8a,
      this.getPSNavigateParams(),
      objKey,
    ) as IPSNavigateParam;
  }

  get parentFilter(): string {
    return this.M.parentFilter;
  }

  protected parentpsappdefield: IPSAppDEField;
  getParentPSAppDEField(): IPSAppDEField | null {
    if (this.parentpsappdefield != null) return this.parentpsappdefield;
    const value = this.M.getParentPSAppDEField;
    if (value == null) {
      return;
    }
    this.parentpsappdefield = this.getChildPSDETreeNode()
      .getPSAppDataEntity()
      .findPSAppDEField(value);
    return this.parentpsappdefield;
  }

  protected parentpsder1n: IPSDER1N;
  getParentPSDER1N(): IPSDER1N | null {
    return (
      this.parentpsder1n ||
      (this.parentpsder1n = this.fillObjectModel(
        S._273,
        this.M.getParentPSDER1N,
        S._31a,
      ) as IPSDER1N)
    );
  }

  protected parentpsdetreenode: IPSDETreeNode;
  getParentPSDETreeNode(): IPSDETreeNode | null {
    if (this.parentpsdetreenode != null) return this.parentpsdetreenode;
    const value = this.M.getParentPSDETreeNode;
    if (value == null) {
      return;
    }
    const ipsdetree = this.getParentPSModelObject(S._264) as IPSDETree;
    if (ipsdetree != null) {
      this.parentpsdetreenode = ipsdetree.findPSDETreeNode(value);
    }
    return this.parentpsdetreenode;
  }

  get parentValueLevel(): 1 | 2 | 3 {
    return this.M.parentValueLevel;
  }

  get searchMode(): 1 | 2 | 3 {
    return this.M.searchMode;
  }
  get cls(): string {
    return 'PSDETreeNodeRSImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._7 || cls == S._1b5) return true;
    return super.instanceof(cls);
  }
}
